package com.ultrapower.bean;

import java.util.Comparator;

public class AgentInfoBean {
	public static final Comparator<AgentInfoBean> AGENT_NAME_ASC_COMPARATOR = new Comparator<AgentInfoBean>() {
		@Override
		public int compare(AgentInfoBean lhs, AgentInfoBean rhs) {
			final String lhsAgentId = lhs.agentId == null ? "" : lhs.agentId;
			final String rhsAgentId = rhs.agentId == null ? "" : rhs.agentId;
			return lhsAgentId.compareTo(rhsAgentId);
		}
	};

	private String applicationName;
	private String agentId;
	private long startTimestamp;
	private String hostName;
	private String ip;
	private String ports;
	private short serviceTypeCode;
	private int pid;
	private String vmVersion;
	private String agentVersion;
	private ServerMetaDataBean serverMetaData;
	private JvmInfoBean jvmInfo;
	private long initialStartTimestamp;
	// private AgentStatus status;

	public AgentInfoBean() {
	}

	public String getApplicationName() {
		return applicationName;
	}

	public void setApplicationName(String applicationName) {
		this.applicationName = applicationName;
	}

	public String getAgentId() {
		return agentId;
	}

	public void setAgentId(String agentId) {
		this.agentId = agentId;
	}

	public long getStartTimestamp() {
		return startTimestamp;
	}

	public void setStartTimestamp(long startTimestamp) {
		this.startTimestamp = startTimestamp;
	}

	public String getHostName() {
		return hostName;
	}

	public void setHostName(String hostName) {
		this.hostName = hostName;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public String getPorts() {
		return ports;
	}

	public void setPorts(String ports) {
		this.ports = ports;
	}

	public short getServiceTypeCode() {
		return serviceTypeCode;
	}

	public void setServiceTypeCode(short serviceTypeCode) {
		this.serviceTypeCode = serviceTypeCode;
	}

	public int getPid() {
		return pid;
	}

	public void setPid(int pid) {
		this.pid = pid;
	}

	public String getVmVersion() {
		return vmVersion;
	}

	public void setVmVersion(String vmVersion) {
		this.vmVersion = vmVersion;
	}

	public String getAgentVersion() {
		return agentVersion;
	}

	public void setAgentVersion(String agentVersion) {
		this.agentVersion = agentVersion;
	}

	public long getInitialStartTimestamp() {
		return initialStartTimestamp;
	}

	public void setInitialStartTimestamp(long initialStartTimestamp) {
		this.initialStartTimestamp = initialStartTimestamp;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		AgentInfoBean agentInfo = (AgentInfoBean) o;

		if (startTimestamp != agentInfo.startTimestamp)
			return false;
		return agentId != null ? agentId.equals(agentInfo.agentId) : agentInfo.agentId == null;

	}

	@Override
	public int hashCode() {
		int result = agentId != null ? agentId.hashCode() : 0;
		result = 31 * result + (int) (startTimestamp ^ (startTimestamp >>> 32));
		return result;
	}

	public ServerMetaDataBean getServerMetaData() {
		return serverMetaData;
	}

	public void setServerMetaData(ServerMetaDataBean serverMetaData) {
		this.serverMetaData = serverMetaData;
	}

	public JvmInfoBean getJvmInfo() {
		return jvmInfo;
	}

	public void setJvmInfo(JvmInfoBean jvmInfo) {
		this.jvmInfo = jvmInfo;
	}

	@Override
	public String toString() {
		return "AgentInfoBean [applicationName=" + applicationName + ", agentId=" + agentId + ", startTimestamp="
				+ startTimestamp + ", hostName=" + hostName + ", ip=" + ip + ", ports=" + ports + ", serviceTypeCode="
				+ serviceTypeCode + ", pid=" + pid + ", vmVersion=" + vmVersion + ", agentVersion=" + agentVersion
				+ ", serverMetaData=" + serverMetaData + ", jvmInfo=" + jvmInfo + ", initialStartTimestamp="
				+ initialStartTimestamp + "]";
	}

}
